//
//  LBShareCell.m
//  share
//
//  Created by 杨庆人 on 17/4/7.
//  Copyright © 2017年 杨庆人. All rights reserved.
//

#import "LBShareCell.h"
#import <Masonry/Masonry.h>

@interface LBShareCell ()
@property (nonatomic,strong)UIImageView * imageView;
@property (nonatomic,strong)UILabel * titleLabel;
@end

@implementation LBShareCell

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self setLBShareCell];
    }
    return self;
}


- (UIImageView *)imageView {
    if (!_imageView) {
        _imageView = [[UIImageView alloc] init];
    }
    return _imageView;
}
- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        _titleLabel.font = [UIFont systemFontOfSize:12];
        _titleLabel.textColor = [UIColor colorWithRed:134/255.0 green:134/255.0 blue:134/255.0 alpha:1];
        _titleLabel.numberOfLines = 0;
    }
    return _titleLabel;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    __weak typeof(self)weakSelf = self;
    [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.mas_equalTo(50);
        make.centerX.mas_equalTo(weakSelf);
        make.bottom.mas_equalTo(weakSelf.mas_centerY).offset(10);
    }];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(weakSelf.imageView.mas_bottom).offset(5);
        make.left.right.mas_equalTo(weakSelf);
    }];

}
- (void)setLBShareCell {
    [self addSubview:self.imageView];
    [self addSubview:self.titleLabel];

}



- (void)setCellWithShareItemModel:(LBChannelModel *)model {
    self.imageView.image = model.image;
    self.titleLabel.text = model.name;
}

@end
